home *** CD-ROM | disk | FTP | other *** search
- property spriteNum, motion, location, row
- global tableau, getlist, equal, currentsel, godlist, foundation, points, stock
-
- on beginSprite me
- if not listp(tableau) then
- tableau = [:]
- end if
- row = determinerow()
- if not objectp(tableau[row]) then
- tableau.addProp(row, new(script("card pile")))
- end if
- if (row = #tone) or (row = #ttwo) or (row = #tthree) or (row = #tfour) then
- if tableau[row].getcardcount() < 7 then
- sprite(spriteNum).member = member(stock.cards[1].rank & "_" & stock.cards[1].suit, "playing cards")
- stock.cards.deleteAt(1)
- tableau[row].addCard(spriteNum)
- end if
- else
- if (row = #tfive) or (row = #tsix) or (row = #tseven) or (row = #teight) then
- if tableau[row].getcardcount() < 6 then
- sprite(spriteNum).member = member(stock.cards[1].rank & "_" & stock.cards[1].suit, "playing cards")
- stock.cards.deleteAt(1)
- tableau[row].addCard(spriteNum)
- end if
- end if
- end if
- location = sprite(spriteNum).loc
- end
-
- on mouseDown me
- if tableau[row].getcardcount() > 0 then
- if spriteNum = tableau[row].getlastcard().spnum then
- puppetSound(3, member("pick card", "100GPak Generic SFX"))
- sprite(spriteNum).locZ = spriteNum + 1000
- getlist = tableau[row]
- motion = timeout(string(spriteNum) && "motion").new(5, #moving, me)
- end if
- if sprite(spriteNum).member = member("empty", "playing cards") then
- sendSprite(spriteNum - 1, #mouseDown)
- end if
- end if
- end
-
- on moving me
- if the mouseDown then
- sprite(spriteNum).loc = the mouseLoc
- else
- if the mouseUp then
- sprite(spriteNum).locZ = spriteNum
- motion.forget()
- abort()
- end if
- end if
- end
-
- on mouseUp me
- if equal then
- puppetSound(3, member("pick card", "100GPak Generic SFX"))
- sprite(currentsel).member = member(sprite(spriteNum).member.name, "playing cards")
- sprite(spriteNum).member = member("empty", "playing cards")
- godlist.addCard(currentsel)
- sprite(spriteNum).loc = location
- tableau[row].cards.deleteOne(tableau[row].getlastcard())
- if objectp(foundation[sprite(currentsel).row]) then
- points = points + 10
- end if
- equal = 0
- currentsel = 0
- godlist = VOID
- getlist = VOID
- repeat with i = 132 to 139
- if tableau[sprite(i).row].getcardcount() = 0 then
- next repeat
- end if
- sprite(i).loc = tableau[sprite(i).row].getlastcard().location
- end repeat
- checkwin()
- else
- if not equal then
- if sprite(spriteNum).member.name <> "empty" then
- puppetSound(3, member("drop card", "100GPak Generic SFX"))
- getlist = VOID
- sprite(spriteNum).loc = location
- end if
- end if
- end if
- checkwin()
- end
-
- on determinerow me
- if (spriteNum >= 14) and (spriteNum <= 27) then
- return #tone
- else
- if (spriteNum >= 28) and (spriteNum <= 42) then
- return #ttwo
- else
- if (spriteNum >= 43) and (spriteNum <= 56) then
- return #tthree
- else
- if (spriteNum >= 57) and (spriteNum <= 70) then
- return #tfour
- else
- if (spriteNum >= 71) and (spriteNum <= 84) then
- return #tfive
- else
- if (spriteNum >= 85) and (spriteNum <= 99) then
- return #tsix
- else
- if (spriteNum >= 100) and (spriteNum <= 113) then
- return #tseven
- else
- if (spriteNum >= 114) and (spriteNum <= 127) then
- return #teight
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end
-